import { Layout, Menu, Dropdown, Badge, Avatar, Select } from 'antd';
import { useEffect, useState } from "react";
import { getLocale, NavLink, setLocale, useIntl } from "umi";
// getLocale, setLocale, useIntl 
import { BellOutlined } from '@ant-design/icons';
// 引入面包屑组件
import Breadcrumb from '../components/breadcrumb';
import { gitUserInfo } from '@/services/modules/useref';
import "./teachers.less"
const { Header, Footer, Content } = Layout
//实训
const practical = (
    <Menu>
        <Menu.Item key="1">
            <NavLink to="/teachers/planList/planList" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "计划"]); }}> 计划</NavLink>
        </Menu.Item>
        <Menu.Item key="2">
            <NavLink to="/teachers/training/training" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "进度"]); }}>进度</NavLink>
        </Menu.Item>
        <Menu.Item key="3">
            <NavLink to="/teachers/defence/defence" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "答辩"]); }}>答辩</NavLink>
        </Menu.Item>

    </Menu>
);
// 面试
const plan = (
    <Menu>
        <Menu.Item key="1">
            <NavLink to="/teachers/interView/interviewList" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "面试记录"]); }}> 面试记录</NavLink>
        </Menu.Item>
        <Menu.Item key="2">
            <NavLink to="/teachers/interView/interviewManage" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "面试管理"]); }}> 面试记录管理</NavLink>
        </Menu.Item>
        <Menu.Item key="3">
            <NavLink to="/teachers/interView/rankList" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "面试排行榜"]); }}> 面试排行榜</NavLink>
        </Menu.Item>
    </Menu>
);
// 问答
const questions = (
    <Menu>
        <Menu.Item key="1">
            <NavLink to="/teachers/question/questionDetail" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "问答列表"]); }}>
                问答列表
            </NavLink>
        </Menu.Item>
        <Menu.Item key="2">
            <NavLink to="/teachers/manage/manage" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "问答管理"]); }}>
                问答管理
            </NavLink>
        </Menu.Item>
    </Menu>
);
// 消息提示
const menu = (
    <Menu>
        <Menu.Item key="1">
            <a target="_blank" rel="noopener noreferrer" href="https://www.antgroup.com">
                1st menu item
            </a>
        </Menu.Item>
        <Menu.Item key="2">
            <a target="_blank" rel="noopener noreferrer" href="https://www.aliyun.com">
                2nd menu item
            </a>
        </Menu.Item>
        <Menu.Item key="3">
            <a target="_blank" rel="noopener noreferrer" href="https://www.luohanacademy.com">
                3rd menu item
            </a>
        </Menu.Item>
    </Menu>
);
// 个人中心
const personage = (
    <Menu>
        <Menu.Item>
            <NavLink to="/teachers/userInfo/teacherPersonCenter" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "个人中心"]); }}>
                个人中心
            </NavLink>
        </Menu.Item>
        <Menu.Item>
            <NavLink to="/teachers/userInfo/needHandle" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "我的待办"]); }}>
                我的待办
            </NavLink>
        </Menu.Item>
        <Menu.Item>
            <NavLink to="/login/login" onClick={() => { window._hmt.push(['_trackEvent', "teachers", "click", "导航菜单", "退出"]); }}>
                退出
            </NavLink>
        </Menu.Item>
    </Menu>
);

// 默认语言
const enLanguage: { [key: string]: string } = {
    "en": "en-US",
    "en-US": "en-US",
}

const TeachersL: React.FC = (props) => {
    let [img, setImg] = useState()

    // 定义默认的值
    const intl = useIntl();
    useEffect(() => {
        console.log(navigator.language)
        let language = navigator.language;
        if (language) {
            setLocale(enLanguage[language], false);
        }
    }, [])

    useEffect(() => {
        gitUserInfo().then(ok => {
            if (ok.code === 200) {
                setImg(ok.user.avatar)
            }
        })
    }, [])


    return <Layout >
        <Header>
            <div className='header'>
                <img src="http://111.203.59.61:8060/static/img/w_bw.172a76e5.png" alt="" />
                <div className="nav">
                    <NavLink to='/teachers/postSkill'>{intl.formatMessage({ id: "breadcrumb.postSkill" })}</NavLink>
                    <NavLink to='/teachers/proManagement/proManagement'>{intl.formatMessage({ id: "breadcrumb.teachers" })}</NavLink>
                    <Dropdown overlay={practical}>
                        <span>{intl.formatMessage({ id: "breadcrumb.proManagement" })}</span>
                    </Dropdown>
                    <Dropdown overlay={plan}>
                        <span>{intl.formatMessage({ id: "breadcrumb.interview" })}</span>
                    </Dropdown>
                    <Dropdown overlay={questions}>
                        <span>{intl.formatMessage({ id: "breadcrumb.essay" })}</span>
                    </Dropdown>
                </div>
                <Dropdown overlay={menu} placement="bottomRight">
                    <Badge count={5}>
                        <BellOutlined style={{ fontSize: "25px", color: "#fff" }} />
                    </Badge>
                </Dropdown>
                <Dropdown overlay={personage} className='personage'>
                    <span><img src={`http://111.203.59.61:8060${img}`} alt="" style={{ width: "35px", height: "35px", borderRadius: "50%", marginRight: "10px" }} />郭老师</span>
                </Dropdown>
                <Select value={getLocale()} onChange={value => setLocale(value, false)}>
                    <Select.Option style={{ width: "100px", height: "30px" }} value="en-US">Engilish</Select.Option>
                    <Select.Option style={{ width: "100px", height: "30px" }} value="zh-CN">中文</Select.Option>
                    <Select.Option style={{ width: "100px", height: "30px" }} value="ko-KR">한국어</Select.Option>
                </Select>
            </div>
        </Header>
        {/* <Breadcrumb/> */}
        <Content>{props.children}</Content>
        <Footer>
            <div data-v-01b3f466="" data-v-7178e8ae="" className="bw_bottom">
                <div data-v-01b3f466="" className="b_b_detail">
                    <div data-v-01b3f466="" className="b_b_left">
                        <div data-v-01b3f466="" className="bw_img">
                            <img src="http://111.203.59.61:8060/static/img/bottom_logo.c8aa9859.png" alt="" />
                        </div>
                        <div data-v-01b3f466="" className="b_w_tel">400-008-0987</div></div>
                    <div data-v-01b3f466="" className="b_b_middle"><div data-v-01b3f466="" className="middle_one middle">
                        <div data-v-01b3f466="" className="middle_title">走进八维</div>
                        <div data-v-01b3f466="" className="href_a">
                            <a data-v-01b3f466="" href="http://bwie.cn/bwie/about.html">集团概况</a></div>
                        <div data-v-01b3f466="" className="href_a">
                            <a data-v-01b3f466="" href="http://bwie.cn/bwie/news/index.html">八维动态</a></div>
                        <div data-v-01b3f466="" className="href_a"><a data-v-01b3f466="" href="http://bwie.cn/bwie/lead.html">领导关怀</a></div>
                        <div data-v-01b3f466="" className="href_a"><a data-v-01b3f466="" href="http://bwie.cn/bwie/honour.html">企业荣誉</a></div></div>
                        <div data-v-01b3f466="" className="middle_two middle">
                            <div data-v-01b3f466="" className="middle_title">八维文化</div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/culture.html">八维理念</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/spirit.html">八维精神</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/dak.html">文化驿站</a></div></div>
                        <div data-v-01b3f466="" className="middle_three middle">
                            <div data-v-01b3f466="" className="middle_title">社会责任</div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/duty/public.html">社会公益</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/duty/great.html">大善之举</a></div></div>
                        <div data-v-01b3f466="" className="middle_four middle">
                            <div data-v-01b3f466="" className="middle_title">联系我们</div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/partners.html">业务合作</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/sign_up.html">咨询报名</a></div>
                            <div data-v-01b3f466="" className="href_a">
                                <a data-v-01b3f466="" href="http://bwie.cn/bwie/concact.html">联系方式</a></div>
                        </div>
                    </div>
                    <div data-v-01b3f466="" className="b_b_right">
                        <img src="http://111.203.59.61:8060/static/img/wechat.e60a83ec.png" alt="" />
                        <div data-v-01b3f466="" className="wechat_text">八维微信公众号</div></div></div>
                <div data-v-01b3f466="" className="b_b_sign">京公网安备 11010802031438号 © Copyright 2020. 八维教育版权所有 | 京ICP备12008262号-12</div>
            </div>
        </Footer>
    </Layout >
}

export default TeachersL

// function useState(): [any, any] {
//     throw new Error('Function not implemented.');
// }
